home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 December / Ahoy_Magazine_86-12_1986_Double_L.d64 / Round Robin (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  666b  |  33 lines

  1. 0 rem << cd36-9 >>
  2. 1 rem commodares problem #32-3:
  3. 2 print"[147]           round robin"
  4. 3 rem solution by
  5. 4 rem     fred ransom
  6. 5 rem
  7. 10 input "number of teams";n
  8. 20 dim t$(n)
  9. 30 for k=0 to n-1
  10. 40 print"team number ";k+1;: input t$(k)
  11. 50 next k
  12. 55 if (n and 1) then n=n+1:t$(n-1)="---"
  13. 60 input "to (p)rinter or (s)creen [s]";fl$
  14. 70 dev=3 : if fl$="p" then dev=4
  15. 80 open 4,dev
  16. 90 for j=1 to n-1
  17. 100 for a=1 to 3 : print#4 : next
  18. 110 print#4,"round ",j
  19. 120 print#4,"home", "away"
  20. 130 print#4,"======", "======"
  21. 140 for k=0 to (n/2-1)
  22. 150 if (j and 1)=1 then print#4, t$(k), t$(k+n/2)
  23. 160 if (j and 1)=0 then print#4, t$(k + n/2), t$(k)
  24. 170 next k
  25. 180 a$=t$(1)
  26. 190 if n < 3 then 240
  27. 200 for k=2 to n-1
  28. 210 t$(k-1)=t$(k)
  29. 220 next k
  30. 230 t$(n-1)=a$
  31. 240 next j
  32. 250 close 4
  33.